#ifndef RAY_TRACE_PRO_OBJ_MODEL_H
#define RAY_TRACE_PRO_OBJ_MODEL_H

#include "Basic/GxLibBasic.h"
#include "VectorMath.h"

namespace RayTracePro
{
	using namespace GxLibBasic;
	using namespace GxLibMath;

	struct ObjFace
	{
		int VertexIds[3];
		int NormalIds[3];
		int TexCoordIds[3];
		unsigned int SmoothGroup;
		int MaterialId;
	};
	struct ObjMaterial
	{
		float SpecularRate;
		Vec3 Diffuse, Specular;
		String DiffuseMap, BumpMap;
	};
	struct ObjModel
	{
		Array<RefPtr<ObjMaterial>> Materials;
		Array<Vec3, true> Vertices, Normals;
		Array<Vec2, true> TexCoords;
		Array<ObjFace, true> Faces;
	};
	bool LoadObj(ObjModel & mdl, const char * fileName);
	void RecomputeNormals(ObjModel & mdl);
}

#endif